Skip to content

✨ OPRUN-3722: Consolidate configuration #1790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

tmshort
Copy link
Contributor

@tmshort tmshort commented Feb 18, 2025

Fix #1341

This moves all the configuration into the root config directory. The config/README.md file shows the result.

Updated Makefile, goreleaser, documentation and some of the unit test code.

Kept CRDs in their original locations, but made copies to the new locations to keep the verify-crd-compatibility target working properly. Once this is merged, a followup will remove the CRDs from the original locations and update the verify-crd-compatibility target.

It also tries to make catalogd less of a second-class piece of code.

I compared the resulting operator-controller.yaml with main, and with the exception of image locations, they are identical.

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@tmshort tmshort requested a review from a team as a code owner February 18, 2025 18:34
Copy link

netlify bot commented Feb 18, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 2278c8a
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67b500742b5a3f0008784818
😎 Deploy Preview https://deploy-preview-1790--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tmshort tmshort changed the title :spakrles: Consolidate configuration ✨ Consolidate configuration Feb 18, 2025
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.34%. Comparing base (17220c2) to head (2278c8a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1790      +/-   ##
==========================================
- Coverage   68.39%   68.34%   -0.06%     
==========================================
  Files          63       63              
  Lines        5117     5117              
==========================================
- Hits         3500     3497       -3     
- Misses       1388     1390       +2     
- Partials      229      230       +1     
Flag Coverage Δ
e2e 51.62% <ø> (-0.16%) ⬇️
unit 55.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tmshort tmshort force-pushed the consolidate-config branch 3 times, most recently from 0c5081c to 1205f2d Compare February 18, 2025 19:37
@tmshort tmshort changed the title ✨ Consolidate configuration ✨ OPRUN-3722: Consolidate configuration Feb 18, 2025
@tmshort tmshort force-pushed the consolidate-config branch 2 times, most recently from 6092506 to 1aeadbb Compare February 18, 2025 19:53
@LalatenduMohanty
Copy link
Member

@tmshort Looks good me me. Let me know when it is readyu to approve it.

@LalatenduMohanty LalatenduMohanty self-requested a review February 18, 2025 19:54
@tmshort
Copy link
Contributor Author

tmshort commented Feb 18, 2025

@tmshort Looks good me me. Let me know when it is readyu to approve it.

Just waiting for everything to pass...

This moves all the configuration into the root config directory.
The config/README.md file shows the result.

Updated Makefile, goreleaser, documentation and some of the unit test code.

Kept CRDs in their original locations, but made copies to the new
locations to keep the verify-crd-compatibility target working properly.
Once this is merged, a followup will remove the CRDs from the original
locations and update the verify-crd-compatibility target.

It also tries to make catalogd less of a second-class piece of code.

I compared the resulting operator-controller.yaml with main, and with
the exception of `image` locations, they are identical.

Signed-off-by: Todd Short <[email protected]>
@joelanford
Copy link
Member

I compared the resulting operator-controller.yaml with main, and with the exception of image locations, they are identical.

How did you do this comparison? I used make quickstart just now on both main and your branch, and I'm seeing a large diff (I think because the catalogd and operator-controller manifests are now interleaved due to apiVersion/kind sorting?)

@tmshort
Copy link
Contributor Author

tmshort commented Feb 18, 2025

How did you do this comparison? I used make quickstart just now on both main and your branch, and I'm seeing a large diff (I think because the catalogd and operator-controller manifests are now interleaved due to apiVersion/kind sorting?)

I used yq to split the resources out by type into their own file (without an index), and then diff'd directories.

mkdir split
cd split
yq -s '(.kind|downcase) +"-"+ (.metadata.namespace // "") +"-"+ .metadata.name' ../operator-controller.yaml

This eliminates duplicates, since the second identically-named-typed resource overwrites the first one. If you include $index into the string above, you'll end up with duplicates that (likely) get overwritten.

@@ -0,0 +1,441 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://github.com/operator-framework/operator-controller/tree/2278c8a97e0bc84fc88aa35bdc18df551a90c448/config/base/crd/bases

Should the operator-controller CRD not be under base/operator-cotroller//crd/bases as well?

Copy link
Contributor Author

@tmshort tmshort Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmshort
Copy link
Contributor Author

tmshort commented Feb 19, 2025

Diff with main operator-controller.yaml:

$ diff ~/originals/split .
diff /home/tshort/originals/split/certificate-olmv1-system-catalogd-service-cert.yml ./certificate-olmv1-system-catalogd-service-cert.yml
19c19
<   secretName: catalogd-service-cert-v1.2.0-rc4-63-g17220c26
---
>   secretName: catalogd-service-cert-v1.2.0-rc4-64-g2278c8a9
diff /home/tshort/originals/split/deployment-olmv1-system-catalogd-controller-manager.yml ./deployment-olmv1-system-catalogd-controller-manager.yml
50c50
<           image: quay.io/operator-framework/catalogd:v1.2.0-rc4-63-g17220c26
---
>           image: quay.io/operator-framework/catalogd:v1.2.0-rc4-64-g2278c8a9
94c94
<             secretName: catalogd-service-cert-v1.2.0-rc4-63-g17220c26
---
>             secretName: catalogd-service-cert-v1.2.0-rc4-64-g2278c8a9
101c101
<             secretName: catalogd-service-cert-v1.2.0-rc4-63-g17220c26
---
>             secretName: catalogd-service-cert-v1.2.0-rc4-64-g2278c8a9
diff /home/tshort/originals/split/deployment-olmv1-system-operator-controller-controller-manager.yml ./deployment-olmv1-system-operator-controller-controller-manager.yml
50c50
<           image: quay.io/operator-framework/operator-controller:v1.2.0-rc4-63-g17220c26
---
>           image: quay.io/operator-framework/operator-controller:v1.2.0-rc4-64-g2278c8a9
diff /home/tshort/originals/split/namespace--olmv1-system.yml ./namespace--olmv1-system.yml
1d0
< ---

name: controller-manager
namespace: system
name: operator-controller-controller-manager
namespace: olmv1-system
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both was changed when we run kustomize build
Could we not leave as before for we centralize the namespace name and prefix in the kustomization.yaml instead?

Copy link
Contributor Author

@tmshort tmshort Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a patch for a specific deployment. Since the configurations are combined, there are two "controller-manager" deployments before their prefixes are applied. We need to be specific here - because this is a component "outside" the base resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error without these changes:

Error: accumulating components: accumulateDirectory: "recursed accumulation of path '/home/tshort/git/operator-framework/operator-controller/config/components/coverage': multiple matches for Id Deployment.v1.apps/controller-manager.system; failed to find unique target for patch Deployment.v1.apps/controller-manager.system"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine; we can always change things if we need them in the future as well.
i think we would need a kustomize for each

name: controller-manager
namespace: system
name: operator-controller-controller-manager
namespace: olmv1-system
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Copy link
Contributor Author

@tmshort tmshort Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a patch for a specific deployment. Since the configurations are combined, there are two "controller-manager" deployments before their prefixes are applied. We need to be specific here - because this is a component "outside" the base resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error without these changes:

 Error: accumulating components: accumulateDirectory: "recursed accumulation of path '/home/tshort/git/operator-framework/operator-controller/config/components/registries-conf': multiple matches for Id Deployment.v1.apps/controller-manager.system; failed to find unique target for patch Deployment.v1.apps/controller-manager.system"

@@ -8,6 +8,3 @@
- op: remove
# remove --leader-elect so container doesn't restart during breakpoints
path: /spec/template/spec/containers/0/args/2
- op: add
path: /spec/template/spec/containers/0/args/-
value: --feature-gates=PreflightPermissions=true
Copy link
Contributor

@camilamacedo86 camilamacedo86 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we remove it intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Joe asked for it to be removed.
#1790 (comment)

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: operator-controller-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the comments to clarify how it is used?

Copy link
Contributor Author

@tmshort tmshort Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't think the comments are useful here.

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Great work 🥇
Thank you for looking on that

@tmshort tmshort added this pull request to the merge queue Feb 19, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 19, 2025
Merged via the queue into operator-framework:main with commit 2a5e9b8 Feb 19, 2025
20 of 21 checks passed
@tmshort tmshort deleted the consolidate-config branch February 19, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate catalogd and operator-controller Kustomize configs
5 participants